import {Injectable} from '@angular/core';
import {Http} from '@angular/http';
import 'rxjs/add/operator/map';
import {Observable} from "rxjs/Observable";

class getDetails {
    msg:string;
}

@Injectable()
export class DetailProvider {

    constructor(public http: Http) {
        console.log('Hello DetailProvider Provider');
    }

    //any和getDetails的区别
    getDetails():Observable<getDetails> {
       return this.http.get('http://localhost:8080/api/GetOrPostDetails', {params:{'aaa':123}})
            .map(res => {
               return res.json();
            })
    }

    postDetails():Observable<any> {
       return this.http.post('http://localhost:8080/api/GetOrPostDetails', {a:1,b:2})
            .map(res => {
                return res.json();
            });
    }
}
